package com.xzw.test.springcloud;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 参考地址: https://www.jianshu.com/p/cf71f7fc715e
 *
 * 开启断路器功能:@EnableCircuitBreaker
 */
@SpringBootApplication
@EnableCircuitBreaker
@EnableEurekaClient
public class HystrixApp{
    public static void main( String[] args ){
        SpringApplication.run(HystrixApp.class,args);
    }

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
